<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wadl="http://research.sun.com/wadl/2006/10"
exclude-result-prefixes="wadl"
>

<xsl:template match="/wadl:application">
<pre>
<xsl:apply-templates select="wadl:resources/wadl:resource" />
</pre>
</xsl:template>

<xsl:template match="wadl:resource">

== <xsl:for-each select="ancestor-or-self::wadl:resource">/<xsl:value-of select="@path" /></xsl:for-each> ==
<xsl:apply-templates select="wadl:doc" />

<xsl:for-each select="ancestor-or-self::wadl:resource">
<xsl:apply-templates select="wadl:param" />
</xsl:for-each>

&lt;table border="1" cellpadding="5"&gt;
<xsl:apply-templates select="wadl:method" />
&lt;/table&gt;

<xsl:apply-templates select="wadl:resource" />
</xsl:template>

<xsl:template match="wadl:doc">
<xsl:copy-of select="." />
</xsl:template>

<xsl:template match="wadl:param">
  * `<xsl:value-of select="@name" />` as <xsl:value-of select="@style" /> (<xsl:if test="@required"><span class="required">required</span></xsl:if>)<xsl:apply-templates select="wadl:doc" /></xsl:template>

<xsl:template match="wadl:representation">
  * `<xsl:value-of select="@status" />`: `<xsl:value-of select="@mediaType" />` with `&lt;<xsl:value-of select="@element" />&gt;`<xsl:apply-templates select="wadl:doc" /></xsl:template>

<xsl:template match="wadl:fault">
  * Possible fault codes: `<xsl:value-of select="@status" />`</xsl:template>

<xsl:template match="wadl:method">

&lt;tr valign="top"&gt;&lt;th colspan="2" align="left"&gt;<xsl:value-of select="@name" />&lt;/th&gt;&lt;/tr&gt;
	<xsl:apply-templates select="wadl:doc" />

&lt;tr valign="top"&gt;&lt;th align="left"&gt;*Request parameters*&lt;/th&gt;&lt;th align="left"&gt;*Response*&lt;/th&gt;&lt;/tr&gt;

&lt;tr valign="top"&gt;&lt;td align="left"&gt;
<xsl:apply-templates select="wadl:request/wadl:param" />
&lt;/td&gt;&lt;td align="left"&gt;
<xsl:apply-templates select="wadl:response/wadl:representation" />
<xsl:apply-templates select="wadl:response/wadl:fault" />
&lt;/td&gt;&lt;/tr&gt;

</xsl:template>

</xsl:stylesheet>